<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>电影系统</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">


    <link rel="stylesheet" th:href="@{/css/pintuer.css}">
    <link rel="stylesheet" th:href="@{/css/admin.css}">

    <script th:src="@{/js/jquery-3.3.1.min.js}" type="text/javascript"></script>
    <!--<script type="text/javascript" src="${pageContext.request.contextPath }/myjs/sale.js"></script>-->

  </head>
  
  <body>
   <div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 选择座位</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" th:action="@{/sale/addSale}" >
        <input type="hidden" th:value="${count}" id="tids">
        <input type="hidden" th:value="${tidsa}" id="tidsa">
        <table style="font-size: 12px;" id="table-seat">
    	 <tr>
    	 <td style="text-indent: 100px;" colspan="10">
    	 	选择座位&nbsp;：&nbsp;
    	 </td>
         </tr>
    </table>
    <br/>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="submit" onclick="return check();"> 完成</button>
        </div>
      </div>
    </form>
  </div>
</div>
</body>
<script>
    $(function(){
        var tids = parseInt($('#tids').val());
        for (var i = 1 ; i <= tids ; i++){
            if (i%18 == 0) {
                $('#table-seat').append('<tr></tr>');
                $('#table-seat tbody').append('<td>\n' +
                    '                      <input type="checkbox" id="seat" name="seat" value="'+i+'"/>' +
                    '<span>'+(i <10 ? '0'+i : i)+'号座</span>&nbsp;&nbsp;\n' +
                    '                  </td>');
            }else {
                $('#table-seat tbody').append('<td>\n' +
                    '                      <input type="checkbox" id="seat" name="seat" value="'+i+'"/>' +
                    '<span>'+(i <10 ? '0'+i : i)+'号座</span>&nbsp;&nbsp;\n' +
                    '                  </td>');

            }
        }
        $.get('../gson/salemzwGson',function(data){
            $(data).each(function(i,n){
                $('input').each(function(m,k){
                    if (n.mzw == $(k).val()){
                        $(k).attr('disabled','disabled');
                        $(k).nextAll('span').html('已售');
                    }
                });
            });
        });
    });
</script>
</html>
